<?php
	class Question{
		private $id; // l'id de la question courante
		private $contenu; // le contenu de la question
		private $idRefExercice; // l'id de l'exercie auquel la question apExercicent	
		private $image; // l'image
		private $ordre; //l'ordre dans l'exercice

	
		public function __construct(){
			if(func_num_args() == 1)
			$this->hydrate(func_get_arg(0));
		}
		
		public function hydrate(array $donnees){
			foreach ($donnees as $key => $value){
				$method = 'set'.ucfirst($key);
				if (method_exists($this, $method)){
					$this->$method($value);
				}
			}
		}
		
		// GETTERS
		public function id(){return $this->id;}
		public function contenu(){return $this->contenu;}
		public function idRefExercice(){return $this->idRefExercice;}
		public function image(){return $this->image;}
		public function ordre(){return $this->ordre;}
		
		// SETTERS
		public function setId($newId){$this->id = $newId;}
		public function setIdRefExercice($newIdRefExercice){$this->idRefExercice = $newIdRefExercice;}
		public function setContenu($newContenu){$this->contenu = $newContenu;}
		public function setImage($newImage){$this->image = $newImage;}
		public function setOrdre($newOrdre){$this->ordre = $newOrdre;}
	}
?>